/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ApproverTaskFrame.java
 *
 * Created on 22 Mei 13, 21:01:45
 */
package com.ivanbiz.gui;

import com.ivanbiz.dao.InternalDeliveryDAO;
import com.ivanbiz.dao.InternalDeliveryItemDAO;
import com.ivanbiz.dao.ItemDAO;
import com.ivanbiz.dao.PurchaseOrderDAO;
import com.ivanbiz.dao.PurchaseOrderItemDAO;
import com.ivanbiz.dao.impl.InternalDeliveryDAOImpl;
import com.ivanbiz.dao.impl.InternalDeliveryItemDAOImpl;
import com.ivanbiz.dao.impl.ItemDAOImpl;
import com.ivanbiz.dao.impl.PurchaseOrderDAOImpl;
import com.ivanbiz.dao.impl.PurchaseOrderItemDAOImpl;
import com.ivanbiz.helper.GlobalConstant;
import com.ivanbiz.helper.GlobalSession;
import com.ivanbiz.helper.ServiceHelper;
import com.ivanbiz.helper.UserSession;
import com.ivanbiz.model.InternalDelivery;
import com.ivanbiz.model.InternalDeliveryItem;
import com.ivanbiz.model.Item;
import com.ivanbiz.model.PurchaseOrder;
import com.ivanbiz.model.PurchaseOrderItem;
import com.ivanbiz.model.User;
import com.ivanbiz.report.InternalDeliveryReport;
import com.ivanbiz.report.PurchaseOrderReport;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

/**
 *
 * @author Shbt Peterpan
 */
public class ApproverTaskStatusFrame extends javax.swing.JInternalFrame {

    List<PurchaseOrderItem> listPurchaseOrderItem = new ArrayList<PurchaseOrderItem>();
    List<PurchaseOrder> listPurchaseOrder = new ArrayList<PurchaseOrder>();
    List<InternalDeliveryItem> listInternalDeliveryItem = new ArrayList<InternalDeliveryItem>();
    List<InternalDelivery> listInternalDelivery = new ArrayList<InternalDelivery>();
    List<Item> listItem = new ArrayList<Item>();
    ItemDAO itemDAO = new ItemDAOImpl();
    InternalDeliveryDAO internalDeliveryDAO = new InternalDeliveryDAOImpl();
    InternalDeliveryItemDAO internalDeliveryItemDAO = new InternalDeliveryItemDAOImpl();
    PurchaseOrderItemDAO purchaseOrderItemDAO = new PurchaseOrderItemDAOImpl();
    PurchaseOrderDAO purchaseOrderDAO = new PurchaseOrderDAOImpl();
    ServiceHelper serviceHelper = new ServiceHelper();
    NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
    User user = UserSession.getUser();

    /** Creates new form ApproverTaskFrame */
    public ApproverTaskStatusFrame() {
        initComponents();
        setVisible(true);
        updateData();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        dialogTask = new javax.swing.JDialog();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tableDataTask = new javax.swing.JTable();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tableData = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        comboSearch = new javax.swing.JComboBox();
        textSearch = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        buttonPrint = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        comboSearch1 = new javax.swing.JComboBox();
        textSearch1 = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tableData1 = new javax.swing.JTable();
        jPanel9 = new javax.swing.JPanel();
        buttonPrint1 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        comboSearch2 = new javax.swing.JComboBox();
        textSearch2 = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tableData2 = new javax.swing.JTable();
        jPanel13 = new javax.swing.JPanel();
        buttonPrint2 = new javax.swing.JButton();

        dialogTask.setModal(true);

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Table Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        tableDataTask.setAutoCreateRowSorter(true);
        tableDataTask.setFont(new java.awt.Font("Monospaced", 1, 14));
        tableDataTask.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tableDataTask.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableDataTaskMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tableDataTask);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout dialogTaskLayout = new javax.swing.GroupLayout(dialogTask.getContentPane());
        dialogTask.getContentPane().setLayout(dialogTaskLayout);
        dialogTaskLayout.setHorizontalGroup(
            dialogTaskLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogTaskLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        dialogTaskLayout.setVerticalGroup(
            dialogTaskLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogTaskLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Table Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        tableData.setAutoCreateRowSorter(true);
        tableData.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        tableData.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tableData.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableDataMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tableData);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        comboSearch.setFont(new java.awt.Font("Monospaced", 1, 14));

        textSearch.setFont(new java.awt.Font("Monospaced", 1, 14));
        textSearch.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textSearchKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(comboSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Button", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        buttonPrint.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        buttonPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/gui/icon/Print.jpg"))); // NOI18N
        buttonPrint.setText("Print");
        buttonPrint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonPrintActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(buttonPrint, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(buttonPrint, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Purchase Order Task", jPanel1);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        comboSearch1.setFont(new java.awt.Font("Monospaced", 1, 14));

        textSearch1.setFont(new java.awt.Font("Monospaced", 1, 14));
        textSearch1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textSearch1KeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(comboSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textSearch1, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Table Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        tableData1.setAutoCreateRowSorter(true);
        tableData1.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        tableData1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tableData1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableData1MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tableData1);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Button", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        buttonPrint1.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        buttonPrint1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/gui/icon/Print.jpg"))); // NOI18N
        buttonPrint1.setText("Print");
        buttonPrint1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonPrint1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 134, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(buttonPrint1, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 48, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addGap(5, 5, 5)
                    .addComponent(buttonPrint1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Internal Delivery Task", jPanel2);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        comboSearch2.setFont(new java.awt.Font("Monospaced", 1, 14));

        textSearch2.setFont(new java.awt.Font("Monospaced", 1, 14));
        textSearch2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textSearch2KeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(comboSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textSearch2, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Table Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        tableData2.setAutoCreateRowSorter(true);
        tableData2.setFont(new java.awt.Font("Monospaced", 1, 14));
        tableData2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane5.setViewportView(tableData2);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 617, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Button", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Monospaced", 0, 11))); // NOI18N

        buttonPrint2.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        buttonPrint2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/gui/icon/Print.jpg"))); // NOI18N
        buttonPrint2.setText("Print");
        buttonPrint2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonPrint2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(buttonPrint2, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addComponent(buttonPrint2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Item Task", jPanel3);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 674, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void textSearchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textSearchKeyReleased
        try {
            listPurchaseOrder = purchaseOrderDAO.getDataByLike((String) comboSearch.getSelectedItem(), textSearch.getText(), "status", GlobalConstant.N);
            updateTablePO();
        } catch (Exception ex) {
            Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_textSearchKeyReleased

    private void textSearch1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textSearch1KeyReleased
        try {
            listInternalDelivery = internalDeliveryDAO.getDataByLike((String) comboSearch1.getSelectedItem(), textSearch1.getText(), "status", GlobalConstant.N);
            updateTableID();
        } catch (Exception ex) {
            Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_textSearch1KeyReleased

    private void tableDataMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableDataMouseClicked
        try {
            if (evt.getClickCount() == 2) {
                listPurchaseOrderItem = purchaseOrderItemDAO.getDataByEquals(PurchaseOrderItem.class, "nomerPO", (String) tableData.getValueAt(tableData.getSelectedRow(), 1));
                updateTablePOI();
                dialogTask.setSize(GlobalSession.getDesktopsize());
                Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                Dimension frameSize = dialogTask.getSize();
                dialogTask.setLocation(
                        (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
                dialogTask.setVisible(
                        true);
            }
        } catch (Exception ex) {
            Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_tableDataMouseClicked

    private void tableData1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableData1MouseClicked
        if (evt.getClickCount() == 2) {
            try {
                listInternalDeliveryItem = internalDeliveryItemDAO.getDataByEquals(InternalDeliveryItem.class, "nomorInternalDelivery", (String) tableData1.getValueAt(tableData1.getSelectedRow(), 1));
                updateTableIDI();
                dialogTask.setSize(GlobalSession.getDesktopsize());
                Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                Dimension frameSize = dialogTask.getSize();
                dialogTask.setLocation(
                        (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
                dialogTask.setVisible(
                        true);
            } catch (Exception ex) {
                Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_tableData1MouseClicked

    private void tableDataTaskMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableDataTaskMouseClicked
}//GEN-LAST:event_tableDataTaskMouseClicked

    private void textSearch2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textSearch2KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_textSearch2KeyReleased

    private void buttonPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrintActionPerformed
        try {
            PurchaseOrder purchaseOrder = listPurchaseOrder.get(tableData.getSelectedRow());
            listPurchaseOrderItem = purchaseOrderItemDAO.getDataByEquals(PurchaseOrderItem.class, "nomerPO", purchaseOrder.getNomerPO());
            PurchaseOrderReport purchaseOrderReport = new PurchaseOrderReport();
            purchaseOrderReport.printPurchaseOrderItem(listPurchaseOrderItem, purchaseOrder);
            updateData();
        } catch (Exception ex) {
            Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

}//GEN-LAST:event_buttonPrintActionPerformed

    private void buttonPrint2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrint2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_buttonPrint2ActionPerformed

    private void buttonPrint1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrint1ActionPerformed
        try {
            InternalDelivery internalDelivery = (InternalDelivery) internalDeliveryDAO.getDataByEquals(InternalDelivery.class, "nomorInternalDelivery", tableData1.getSelectedRow());
            listInternalDeliveryItem = internalDeliveryItemDAO.getDataByEquals(InternalDeliveryItem.class, "nomorInternalDelivery", internalDelivery.getNomorInternalDelivery());
            InternalDeliveryReport internalDeliveryReport = new InternalDeliveryReport();
            internalDeliveryReport.printInternalDeliveryItem(listInternalDeliveryItem, internalDelivery);
            updateData();
        } catch (Exception ex) {
            Logger.getLogger(InternalDeliveryFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_buttonPrint1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonPrint;
    private javax.swing.JButton buttonPrint1;
    private javax.swing.JButton buttonPrint2;
    private javax.swing.JComboBox comboSearch;
    private javax.swing.JComboBox comboSearch1;
    private javax.swing.JComboBox comboSearch2;
    private javax.swing.JDialog dialogTask;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable tableData;
    private javax.swing.JTable tableData1;
    private javax.swing.JTable tableData2;
    private javax.swing.JTable tableDataTask;
    private javax.swing.JTextField textSearch;
    private javax.swing.JTextField textSearch1;
    private javax.swing.JTextField textSearch2;
    // End of variables declaration//GEN-END:variables

    private void updateData() {
        try {
            listPurchaseOrder = purchaseOrderDAO.getDataByEquals(PurchaseOrder.class, "status", GlobalConstant.Y);
            listInternalDelivery = internalDeliveryDAO.getDataByEquals(InternalDelivery.class, "status", GlobalConstant.Y);
            listItem = itemDAO.getDataByEquals(Item.class, "status", GlobalConstant.Y);
            clearTable();
            updateTablePO();
            updateTableID();
            updateTableItem();
            updateComboCariPO();
            updateComboCariID();
        } catch (Exception ex) {
            Logger.getLogger(ApproverTaskStatusFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void clearTable() {
        textSearch.setText(GlobalConstant.EMPTY_STRING);
        textSearch1.setText(GlobalConstant.EMPTY_STRING);
        jPanel4.setVisible(false);
        jPanel5.setVisible(false);
        jPanel11.setVisible(false);
    }

    private void updateTablePOI() {
        String[] judul = {GlobalConstant.NO, GlobalConstant.NO_PO, GlobalConstant.KODE_BARCODE, GlobalConstant.NAMA, GlobalConstant.QUANTITY, GlobalConstant.HARGA_MODAL, GlobalConstant.DISKON, GlobalConstant.DISKON, GlobalConstant.DISKON, GlobalConstant.DISKON, GlobalConstant.TOTAL, GlobalConstant.DESCRIPTION};
        Object[][] isi = null;
        isi = new Object[listPurchaseOrderItem.size()][12];
        int x = 0;
        int no = 0;
        for (PurchaseOrderItem purchaseOrderItem : listPurchaseOrderItem) {
            isi[x][0] = no += 1;
            isi[x][1] = purchaseOrderItem.getNomerPO();
            isi[x][2] = purchaseOrderItem.getKodeBarcode();
            isi[x][3] = purchaseOrderItem.getNamaItem();
            isi[x][4] = purchaseOrderItem.getQuantity();
            isi[x][5] = numberFormat.format(purchaseOrderItem.getHargaModal());
            isi[x][6] = purchaseOrderItem.getDiskon1();
            isi[x][7] = purchaseOrderItem.getDiskon2();
            isi[x][8] = purchaseOrderItem.getDiskon3();
            isi[x][9] = purchaseOrderItem.getDiskon4();
            isi[x][10] = numberFormat.format(purchaseOrderItem.getSubTotal());
            isi[x][11] = purchaseOrderItem.getDescription();
            x++;
        }
        tableDataTask.setModel(new DefaultTableModel(isi, judul) {

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public Class getColumnClass(int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return Boolean.class;
                } else {
                    return columnIdentifiers.get(columnIndex).getClass();
                }
            }
        });

        TableColumn column0 = tableDataTask.getColumnModel().getColumn(0);
        column0.setPreferredWidth(75);
        column0.setMaxWidth(75);
    }

    private void updateTablePO() {
        String[] judul = {GlobalConstant.NO, GlobalConstant.NO_PO, GlobalConstant.SUPPLIER, "Tanggal PO"};
        Object[][] isi = null;
        isi = new Object[listPurchaseOrder.size()][4];
        int x = 0;
        int no = 0;
        for (PurchaseOrder purchaseOrder : listPurchaseOrder) {
            isi[x][0] = no += 1;
            isi[x][1] = purchaseOrder.getNomerPO();
            isi[x][2] = purchaseOrder.getSupplier().getNama();
            isi[x][3] = purchaseOrder.getTanggalPO();
            x++;
        }
        tableData.setModel(new DefaultTableModel(isi, judul) {

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public Class getColumnClass(int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return Boolean.class;
                } else {
                    return columnIdentifiers.get(columnIndex).getClass();
                }
            }
        });

        TableColumn column0 = tableData.getColumnModel().getColumn(0);
        column0.setPreferredWidth(60);
        column0.setMaxWidth(60);
        TableColumn column1 = tableData.getColumnModel().getColumn(1);
        column1.setPreferredWidth(75);
        column1.setMaxWidth(75);
    }

    private void updateComboCariPO() {
        Object[] dataClass = serviceHelper.getPropertyClass(PurchaseOrderItem.class);
        Object[] dataSearch = new Object[1];
        dataSearch[0] = dataClass[11];
        comboSearch.setModel(
                new DefaultComboBoxModel(dataSearch));
    }

    private void updateTableIDI() {
        String[] judul = {GlobalConstant.NO, GlobalConstant.NO_ID, GlobalConstant.KODE_BARCODE, GlobalConstant.NAMA, GlobalConstant.HARGA_MODAL, GlobalConstant.QUANTITY, GlobalConstant.DATE_RECEIVE};
        Object[][] isi = new Object[listInternalDeliveryItem.size()][7];
        int x = 0;
        int no = 0;
        for (InternalDeliveryItem internalDeliveryItem : listInternalDeliveryItem) {
            isi[x][0] = no += 1;
            isi[x][1] = internalDeliveryItem.getNomorInternalDelivery();
            isi[x][2] = internalDeliveryItem.getKodeBarcode();
            isi[x][3] = internalDeliveryItem.getNamaItem();
            isi[x][4] = numberFormat.format(internalDeliveryItem.getHargaModal());
            isi[x][5] = internalDeliveryItem.getQuantity();
            isi[x][6] = internalDeliveryItem.getDateReceive();
            x++;
        }
        tableDataTask.setModel(new DefaultTableModel(isi, judul) {

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public Class getColumnClass(int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return Boolean.class;
                } else {
                    return columnIdentifiers.get(columnIndex).getClass();
                }
            }
        });

        TableColumn column0 = tableDataTask.getColumnModel().getColumn(0);
        column0.setPreferredWidth(75);
        column0.setMaxWidth(75);
        TableColumn column1 = tableDataTask.getColumnModel().getColumn(1);
        column1.setPreferredWidth(75);
        column1.setMaxWidth(75);
    }

    private void updateTableID() {
        String[] judul = {GlobalConstant.NO, GlobalConstant.NO_ID, GlobalConstant.CABANG, "Tanggal Kirim"};
        Object[][] isi = new Object[listInternalDelivery.size()][4];
        int x = 0;
        int no = 0;
        for (InternalDelivery internalDelivery : listInternalDelivery) {
            isi[x][0] = no += 1;
            isi[x][1] = internalDelivery.getNomorInternalDelivery();
            isi[x][2] = internalDelivery.getCabang().getKode();
            isi[x][3] = internalDelivery.getTanggalKirim();
            x++;
        }
        tableData1.setModel(new DefaultTableModel(isi, judul) {

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public Class getColumnClass(int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return Boolean.class;
                } else {
                    return columnIdentifiers.get(columnIndex).getClass();
                }
            }
        });

        TableColumn column0 = tableData1.getColumnModel().getColumn(0);
        column0.setPreferredWidth(60);
        column0.setMaxWidth(60);
        TableColumn column1 = tableData1.getColumnModel().getColumn(1);
        column1.setPreferredWidth(75);
        column1.setMaxWidth(75);
    }

    private void updateComboCariID() {
        Object[] dataClass = serviceHelper.getPropertyClass(InternalDeliveryItem.class);
        Object[] dataSearch = new Object[1];
        dataSearch[0] = dataClass[6];
        comboSearch1.setModel(
                new DefaultComboBoxModel(dataSearch));
    }

    private void updateTableItem() {
        String[] judul = {GlobalConstant.NO, GlobalConstant.KODE_BARCODE, GlobalConstant.NAMA, GlobalConstant.DESCRIPTION};
        Object[][] isi = new Object[listItem.size()][4];
        int x = 0;
        int no = 0;
        for (Item item : listItem) {
            isi[x][0] = no += 1;
            isi[x][1] = item.getKodeBarcode();
            isi[x][2] = item.getNamaItem();
            isi[x][3] = item.getDescription();
            x++;
        }
        tableData2.setModel(new DefaultTableModel(isi, judul) {

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public Class getColumnClass(int columnIndex) {
                if (columnIdentifiers.get(columnIndex).equals(GlobalConstant.CHOOSE)) {
                    return Boolean.class;
                } else {
                    return columnIdentifiers.get(columnIndex).getClass();
                }
            }
        });

        TableColumn column0 = tableData2.getColumnModel().getColumn(0);
        column0.setPreferredWidth(60);
        column0.setMaxWidth(60);
        TableColumn column1 = tableData2.getColumnModel().getColumn(1);
        column1.setPreferredWidth(75);
        column1.setMaxWidth(75);
        TableColumn column2 = tableData2.getColumnModel().getColumn(2);
        column2.setPreferredWidth(150);
        column2.setMaxWidth(150);

    }
}
